package org.myname.struts.example2.action;

import java.io.File;

import com.opensymphony.xwork2.ActionSupport;

public class FileUploadAction extends ActionSupport {
	//下面的变量名必须和<s:file/>里的name一致。这样才能正确mapping过来
	private File testfile;
	//这个是上传的文件的类型<name>ContentType
	private String testfileContentType;
	//这个是上传的文件在客户端时的文件名<name>FileName
	private String testfileFileName;

	public FileUploadAction() {
		// TODO Auto-generated constructor stub
	}
	
	public File getTestfile() {
		return testfile;
	}

	public void setTestfile(File testfile) {
		this.testfile = testfile;
	}

	public String getTestfileContentType() {
		return testfileContentType;
	}

	public void setTestfileContentType(String testfileContentType) {
		this.testfileContentType = testfileContentType;
	}

	public String getTestfileFileName() {
		return testfileFileName;
	}

	public void setTestfileFileName(String testfileFileName) {
		this.testfileFileName = testfileFileName;
	}

	public String execute() {
		//show the upload page. no logic
		return SUCCESS;
	}
	
	 public String upload() {
		 //private File testfile 毕竟是临时文件。我们需要把它另外保存
		 //到我们指定的地方
		 return SUCCESS;
	 }

}
